﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace _3_5
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        private CountDistance car = new CountDistance();

        private void button1_Click(object sender, EventArgs e)
        {

            try
            {
                double km = double.Parse(textBox1.Text);
                car.AddDistance(km);

                textBox2.Text = car.Distance.ToString();
                textBox3.Text = CountDistance.TotalDistance.ToString();

                textBox1.Clear();
            }
            catch (Exception ex)
            {
                MessageBox.Show("请输入有效的数字！");
            }
        }
    }
}
